package cn.analysis.project.service.impl;

import cn.analysis.common.constant.TimeGroupCons;
import cn.analysis.project.domain.CivilCode;
import cn.analysis.project.domain.SysHolographic;
import cn.analysis.project.mapper.SysHolographicMapper;
import cn.analysis.project.service.ISysHolographicService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/** 全息健康度服务层实现类 */
@Service
public class SysHolographicServiceImpl implements ISysHolographicService {

    @Autowired
    private SysHolographicMapper mapper;

    /** 查询一批civilcode的健康度 */
    @Override
    public List<Map<String, Object>> selectListByCiviCodes(List<String> list) {
        return mapper.selectListByCiviCodes(list);
    }

    /** 查询所有全息健康度数据 */
    @Override
    public List<SysHolographic> selectList() {
        return mapper.selectList(null);
    }

    /** 获取当天的数据 */
    @Override
    public List<Map<String, Object>> selectListDay(String code) {
        return mapper.selectListDay(code);
    }

    /** 查询实时健康度 */
    @Override
    public List<Map<String, Object>> selectListRealTime(String code) {
        return mapper.selectListRealTime(code);
    }

    /** 按照分类方式查询全息健康度 */
    @Override
    public List<Map<String, Object>> selectListByGroup(String group, String code) {
        // 日
        if (TimeGroupCons.DAY.equals(group)) return mapper.selectListDay(code);
        // 周
        if (TimeGroupCons.WEEK.equals(group)) return mapper.selectListWeek(code);
        // 月
        if (TimeGroupCons.MONTH.equals(group)) return mapper.selectListMonth(code);
        // 季
        if (TimeGroupCons.QUARTER.equals(group)) return mapper.selectListQuarter(code);
        // 年
        if (TimeGroupCons.YEAR.equals(group)) return mapper.selectListYear(code);
        else return null;
    }
}
